import {HTTP} from '@/utils/HTTP.js'
import {useState, useEffect} from "react";

// 异步请求频道数据
const useMessage = () => {
    const [messageList, setMessageList] = useState([])

    useEffect(() => {

        async function getMessageList() {
            const res = await HTTP({
                url: '/message/user',
                method: 'GET'
            })
            setMessageList(res.data)
        }

        getMessageList()

    }, [])

    return {messageList}
}

export default useMessage